package net.thellium.ddiameter.protocol.avp.parser;

public class Float64Parser implements AVPValueParser {
	public Double parseValue(byte[] bytes) throws AvpDataException {
		if (bytes.length!=8) throw new AvpDataException();
		int i = 0;
		long accum = 0;
		i = 0;
		for (int shiftBy = 0; shiftBy < 64; shiftBy += 8) {
			accum |= ((long) (bytes[i] & 0xff)) << shiftBy;
			i++;
		}
		return Double.longBitsToDouble(accum);
	}
}
